package com.muyu.danmo.service.impl;

import com.muyu.danmo.domain.DanmoCity;
import com.muyu.danmo.domain.DanmoCounty;
import com.muyu.danmo.domain.DanmoProvince;
import com.muyu.danmo.mapper.DanmoProvinceMapper;
import com.muyu.danmo.req.DanmoCountyReq;
import com.muyu.danmo.req.DanmoProvinceReq;
import com.muyu.danmo.service.IDanmoProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 省份Service业务层处理
 *
 * @author yangle
 * @date 2024-09-19
 */
@Service
public class DanmoProvinceServiceImpl implements IDanmoProvinceService
{
    @Autowired
    private DanmoProvinceMapper danmoProvinceMapper;

    /**
     * 查询省份
     *
     * @param id 省份主键
     * @return 省份
     */
    @Override
    public DanmoProvince selectDanmoProvinceById(Long id)
    {
        return danmoProvinceMapper.selectDanmoProvinceById(id);
    }

    /**
     * 查询省份列表
     *
     * @param danmoProvince 省份
     * @return 省份
     */
    @Override
    public List<DanmoProvince> selectDanmoProvinceList(DanmoProvince danmoProvince)
    {
        return danmoProvinceMapper.selectDanmoProvinceList(danmoProvince);
    }

    /**
     * 新增省份
     *
     * @param danmoProvince 省份
     * @return 结果
     */
    @Override
    public int insertDanmoProvince(DanmoProvince danmoProvince)
    {
        return danmoProvinceMapper.insertDanmoProvince(danmoProvince);
    }

    /**
     * 修改省份
     *
     * @param danmoProvince 省份
     * @return 结果
     */
    @Override
    public int updateDanmoProvince(DanmoProvince danmoProvince)
    {
        return danmoProvinceMapper.updateDanmoProvince(danmoProvince);
    }

    /**
     * 批量删除省份
     *
     * @param ids 需要删除的省份主键
     * @return 结果
     */
    @Override
    public int deleteDanmoProvinceByIds(Long[] ids)
    {
        return danmoProvinceMapper.deleteDanmoProvinceByIds(ids);
    }

    /**
     * 删除省份信息
     *
     * @param id 省份主键
     * @return 结果
     */
    @Override
    public int deleteDanmoProvinceById(Long id)
    {
        return danmoProvinceMapper.deleteDanmoProvinceById(id);
    }

    @Override
    public List<DanmoCity> selectProvinceCode( DanmoProvinceReq danmoProvinceReq) {
        return danmoProvinceMapper.selectProvinceCode(danmoProvinceReq);
    }

    @Override
    public List<DanmoCounty> selectCityCode(DanmoCountyReq danmoCountyReq) {
        return danmoProvinceMapper.selectCityCode(danmoCountyReq);
    }
}
